<?php
foreach($query->result() as $row)
{
	$name_data = array(
				'name'        => 'name',
				'id'          => 'name',
				'value'       => $row->name,
				'maxlength'   => '100',
				'size'        => '40'
	            );
	
	$address_street_data = array(
				'name'        => 'address_street',
				'id'          => 'address_street',
				'value'       => $row->address_street,
				'maxlength'   => '100',
				'size'        => '40'
	            );
	
	$address_zipcode_data = array(
				'name'        => 'address_zipcode',
				'id'          => 'address_zipcode',
				'value'       => $row->address_zipcode,
				'maxlength'   => '100',
				'size'        => '40'
	);
	
	$address_city_data = array(
				'name'        => 'address_city',
				'id'          => 'address_city',
				'value'       => $row->address_city,
				'maxlength'   => '100',
				'size'        => '40'
	);
	
	$opening_hours_data = array(
				'name'        => 'opening_hours',
				'id'          => 'opening_hours',
				'value'		  => $row->opening_hours,
				'rows'   	  => '4',
				'cols'        => '32'
	            );
	
	//checkbox variables
	$checkbox_value = Array(false, true);
	$fastfood_value = $row->fastfood;
	$vegetarian_value = $row->vegetarian;
	$takeaway_value = $row->takeaway;
	$alcohol_value = $row->alcohol;
	
	$fastfood_data = array(
				'name'        => 'fastfood',
				'id'          => 'fastfood',
				'value'       => $fastfood_value,
				'checked'	  => $checkbox_value[$fastfood_value]
	);
	
	$vegetarian_data = array(
				'name'        => 'vegetarian',
				'id'          => 'vegetarian',
				'value'       => $vegetarian_value,
				'checked'	  => $checkbox_value[$vegetarian_value]
	);
	
	$takeaway_data = array(
				'name'        => 'takeaway',
				'id'          => 'takeaway',
				'value'       => $takeaway_value,
				'checked'	  => $checkbox_value[$takeaway_value]
	);
	
	$alcohol_data = array(
				'name'        => 'alcohol',
				'id'          => 'alcohol',
				'value'       => $alcohol_value,
				'checked'	  => $checkbox_value[$alcohol_value]
	);
	
	$kitchen_data = array(
				'name'        => 'kitchen',
				'id'          => 'kitchen',
				'value'       => $row->kitchen,
				'maxlength'   => '100',
				'size'        => '40'
	);
};


$attributes = array('class' => 'asdf', 'id' => 'edit_restaurant');
echo form_open('', $attributes);


$yes_no = Array('No', 'Yes');

echo '<table frame="border">';
foreach($query->result() as $row)
{
	echo '
	Restaurant<br/>
	<font size="6">'.$row->name.'</font><br/>
	added '.$row->date.' by '.$row->author.'<br/><br/>
	
	<tr>
		<td>Address</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>Street</td>
		<td>'.form_input($address_street_data).'</td>
	</tr>
	<tr>
		<td>Zipcode</td>
		<td>'.form_input($address_zipcode_data).'</td>
	</tr>
	<tr>
		<td>City</td>
		<td>'.form_input($address_city_data).'</td>
	</tr>
	
	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
	
	
	<tr>
		<td>Kitchen</td>
		<td>'.form_input($kitchen_data).'</td>
	</tr>	
	<tr>
		<td>Opening hours</td>
		<td>'.form_textarea($opening_hours_data).'</td>
	</tr>	
	
	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
	
	<tr>
		<td>Fastfood</td>
		<td>'.form_input($fastfood_data).'</td>
	</tr>	
	<tr>
		<td>Vegetarian</td>
		<td>'.form_input($vegetarian_data).'</td>
	</tr>
	<tr>
		<td>Take-Away</td>
		<td>'.form_input($takeaway_data).'</td>
	</tr>	
	<tr>
		<td>Alcohol Licensing</td>
		<td>'.form_input($alcohol_data).'</td>
	</tr>
	</table>
	<p id="submit_restaurant_display"></p>';
}
echo '<button id="btn_back">Back</button>';
echo form_submit('submit', 'Save Edit', 'id="submit_edit"');
echo form_close();

?>

